//
//  DCRadiusTopView.m
//  Demo
//
//  Created by zhaolin on 2023/1/10.
//

#import "DCRadiusTopView.h"

@interface DCRadiusTopView ()
@property (nonatomic, strong) UILabel *titleLabel;

@end

@implementation DCRadiusTopView


- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        [self configureUI];
    }
    return self;
}

- (void)configureUI {
    self.backgroundColor = [UIColor clearColor];
    UIView *radiusView = [UIView new];
    radiusView.layer.cornerRadius = 30;
    radiusView.layer.masksToBounds = YES;
    radiusView.backgroundColor = [UIColor colorWithString:@"#FFFFFF"];
    [self addSubview:radiusView];
    [radiusView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.top.right.mas_equalTo(0);
        make.height.mas_equalTo(60);
    }];
    
    UIView *white = [UIView new];
    white.backgroundColor = [UIColor colorWithString:@"#FFFFFF"];
    [self addSubview:white];
    [white mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.mas_equalTo(0);
        make.top.mas_equalTo(radiusView.mas_centerY);
        make.bottom.mas_equalTo(0);
    }];
    
    UILabel *titleLabel = [UILabel new];
    _titleLabel = titleLabel;
    titleLabel.textColor = [UIColor colorWithString:@"#1C221B"];
    titleLabel.font = DCFont_PF_Medium(14);
    [self addSubview:titleLabel];
    [titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(53);
        make.top.mas_equalTo(30);
    }];
}

- (void)setTitleName:(NSString *)title {
    self.titleLabel.text = title;
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
